package com.filter;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * servletListener 监听器，可以设置一些东西丢在里边
 * Created by Administrator on 2018-8-18 0018.
 */
public class ProListener implements ServletContextListener {

    private static final Logger log = LogManager.getLogger(ProListener.class);

    @Override
    public void contextInitialized(ServletContextEvent event) {

        try {
            ServletContext servletContext = event.getServletContext();
            //项目全局上下文路径
            servletContext.setAttribute("ctx", servletContext.getContextPath());
        } catch (Exception e) {
            e.printStackTrace();
            log.error(e.getMessage());
        }
    }


    @Override
    public void contextDestroyed(ServletContextEvent arg0) {

    }

}
